package com.youlu.campus.service.ca;

import com.youlu.campus.entity.OrderInfo;
import com.youlu.campus.entity.UserInfoExtend;
import com.youlu.campus.entity.UserPO;
import com.youlu.campus.entity.VO.req.PlaceOrderVO;
import com.youlu.campus.entity.VO.req.PointPlaceOrderVO;
import com.youlu.campus.entity.VO.req.UserCaQueryVO;
import com.youlu.campus.entity.VO.res.CaCollectRes;
import com.youlu.campus.entity.VO.res.UserCaHonorRes;
import com.youlu.campus.entity.ca.UserCa;
import com.youlu.campus.entity.domain.UserCaDomain;
import com.youlu.campus.entity.english.vo.request.CompetitionCaCollectRequest;
import org.springframework.data.domain.Page;

import java.util.List;

public interface UserCaService {

    void create(UserCa req);

    Page<UserCa> list(UserCaQueryVO req);

    /**
     * 积分下单
     *
     * @param req
     * @param userPO
     * @return
     */
    OrderInfo placeOrderByPoint(PointPlaceOrderVO req, UserPO userPO);

    /**
     * 电子证书领取
     *
     * @param caCollectReq
     * @return
     */
    CaCollectRes caReceive(CompetitionCaCollectRequest caCollectReq);

    /**
     * 竞赛电子证书领取
     * @param caCollectReq
     * @return
     */
    CaCollectRes caCollectContest(CompetitionCaCollectRequest caCollectReq);

    UserCaHonorRes checkReceivePaperCollectContest(CompetitionCaCollectRequest caCollectReq);

    /**
     * 获取用户证书信息
     *
     * @param id
     * @param userId
     * @return
     */
    UserCaDomain getUserCaInfo(String id, String userId);


    UserCa findOne(String id);


    void checkCaReceive(String activityId,String userId);

    void updateByUserId(UserInfoExtend userInfoExtend);


    UserCa findByUserIdAndCaTypeAndCaLevel(String userId,String caType,String caLevel,
                                                  String activityId);

    /**
     * 通过用户ID和活动ID查询证书
     * @param userId
     * @param activityId
     * @return
     */
    List<UserCa> findByUserIdAndActivityId(String userId,String activityId);

    /**
     * 根据用户ID、活动ID用户验证
     * @param currentUser
     * @param activityId
     * @return
     */
     List<UserCaHonorRes> findByActivityId(UserPO currentUser,String  activityId);


    /**
     * 电子证书领取-微信小程序
     *
     * @param caCollectReq
     * @return
     */
    CaCollectRes caMiniReceive(CompetitionCaCollectRequest caCollectReq);

    CaCollectRes caReceiveHistory(CompetitionCaCollectRequest caCollectReq);

    /**
     * 电子证书列表
     * @param currentUser
     * @return
     */
    List<UserCaReceiveHistoryService.UserCaReceiveActivity> userCaList(UserPO currentUser);

    /**
     * 移除用户证书信息
     * @param userId
     * @param activityId
     */
    void removeUserCaByUserIdAndActivityId(String userId,String  activityId);

    /**
     * 通过用户ID和活动ID查询证书和业务类型
     * @param userId
     * @param activityId
     * @return
     */
    List<UserCa> findByUserIdAndActivityIdAndTaskBizType(String userId,String activityId,
                                                         String taskBizType);

}
